package com.xfg.search.serviceImpl;

import com.xfg.search.dao.UserDao;
import com.xfg.search.entity.ChineseDrug;
import com.xfg.search.entity.Composition;
import com.xfg.search.entity.DrugPromoted;
import com.xfg.search.entity.Oil;
import com.xfg.search.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Oil> searchByOil( String word) {
        return userDao.findAllByOil(word);
    }

    @Override
    public List<ChineseDrug> searchByChineseDrug(String word) {
        return userDao.findAllByChineseDrug(word);
    }

    @Override
    public List<Composition> searchByComposition(String word) {
        return userDao.findAllByComposition(word);
    }

    @Override
    public List<DrugPromoted> searchByDrugPromoted(String word) {
        return userDao.findByDrugPromoted(word);
    }

    @Override
    public List<Oil> searchOil(String word) {
        return userDao.findByOil(word);
    }

    @Override
    public List<Oil> findDrugPromotedByOil(String word) {
        return userDao.findDrugPromotedByOil(word);
    }

    @Override
    public List<Oil> findCompositionByOil(String word) {
        return userDao.findCompositionByOil(word);
    }

    @Override
    public List<Oil> searchByEfficacy(String word) {
        return userDao.findByEfficacy(word);
    }

    @Override
    public List<String> findOilByDrug(String name) {
        return userDao.findOilByDrug(name);
    }

    @Override
    public List<ChineseDrug> findDrug(String name) {
        return userDao.findByChineseDrug(name);
    }

    @Override
    public Oil findOil(String word) {
        return userDao.findOil(word);
    }

    @Override
    public List<String> findOilByDrugPromoted(String dname) {
        return userDao.findOilByDrugPromoted(dname);
    }


}
